var dragObject, offsetX, offsetY, isDragging=false;
document.onmousemove = mM;
document.onmouseup = mU;

function initializare_drag() {
	var ob = document.getElementById("fereastraDrag");	
	ob.ondrag=function() { return false; };
	ob.onselectstart=function() { return false; };
	
	ob.style.left="470px";
	ob.style.top="70px";
}

function mD(ob,e) {
	dragObject = document.getElementById(ob);
	
	if (window.event) e=window.event;
	
	var dragX = parseInt(dragObject.style.left);
	var dragY = parseInt(dragObject.style.top);
	var browser = detectareBrowser();
	
	var mouseX = e.clientX;
	var mouseY = e.clientY;
	
	offsetX = mouseX - dragX;
	offsetY = mouseY - dragY;
	
	document.getElementById('obiectDrag').style.backgroundImage = 'url(img/tab3.gif)';
	document.getElementById('optiuni_frame').style.backgroundImage = "url('img/disabled.png')";
	
	if (browser != "ie")
	 document.getElementById('drag_fix').focus();

	isDragging = true;
	
	return false;
}

function mM(e) {
	if (!isDragging) return;
	
	if (window.event) e=window.event;
	
	var newX = e.clientX - offsetX;
	var newY = e.clientY - offsetY;
	
	dragObject.style.left = newX + "px";
	dragObject.style.top = newY + "px";
	
	return false;
}

function mU() {
	if (!isDragging) return;
	
	isDragging = false;
	document.getElementById("obiectDrag").style.backgroundImage = "url('img/tab2.gif')";
	document.getElementById('optiuni_frame').style.backgroundImage = "url('img/dot.png')";
	
	return false;
}